/* Laboratorio # 2 - Administración de bases de datos
 Jorge Fallas Ramos         402090469
 José Roberto Sánchez       115400070
 Daniel Villalobos Venegas  402110100
 */

package monitorinitdb;

import java.io.*;

public class ConectorWindows extends ConectorOracle {

    private final String llamado = "sqlplus ", rol = " as sysdba";

    public ConectorWindows(String user, String pass) throws IOException {
        super(user, pass);
        try {
            run.exec(llamado + user + "/" + pass + rol);
        } catch (IOException ex) {
            System.err.println(ex.getMessage());
        }
    }

    @Override
    public void ejecutaInstruccion(String script) {
        try {
            Process p = run.exec("cmd.exe /c echo exit | sqlplus " + this.user + "/" + this.pass + " as sysdba@connect @" + script);
            muestraConsola(p.getInputStream());
        } catch (IOException ex) {
            System.err.println(ex.getMessage());
        }
    }
}
